from flask import Flask
from flask import render_template
app = Flask(__name__)
@app.route("/types/")
def types():
    result = """
    <ul style="background-color:papayawhip; width:50px">
        <li><a href="/type/">目录</a></li>
    </ul>
    """
    return result


@app.route("/type/")
def type():
    result = """
    <ul style="background-color:plum">
        <li><a href="/book/novel/">小说</a></li>
        <li><a href="/book/t_h/">童话</a></li>
        <li><a href="/book/magazine/">漫画</a></li>
        <li><a href="/book/cartoon/">杂志</a></li>
        <li><a href="/book/r_b/">教辅工具</a></li>
    </ul>
    """
    return result


@app.route("/book/novel/")
def novel():
    book_list = [
        {"book_name": "《斗罗大陆》", "author": "唐家三少", "money": "￥32"},
        {"book_name": "《大主宰》", "author": "天蚕土豆", "money": "￥38"},
        {"book_name": "《神墓》", "author": "辰东", "money": "￥30"},
        {"book_name": "《山海密藏》", "author": "道门老九", "money": "￥28"},
        {"book_name": "《元尊》", "author": "天蚕土豆", "money": "￥30"}
    ]
    return render_template("book.html", **locals())


@app.route("/book/t_h/")
def t_h():
    book_list = [
        {"book_name": "《小王子》", "author": "圣埃克苏佩里", "money": "￥36"},
        {"book_name": "《圣埃克苏佩里》", "author": "怀特", "money": "￥28"},
        {"book_name": "《小公主》", "author": "伯内特", "money": "￥30"},
        {"book_name": "《青鸟》", "author": "莫里斯", "money": "￥28"},
        {"book_name": "《安徒生童话》", "author": "安徒生", "money": "￥32"}
    ]
    return render_template("book.html", **locals())


@app.route("/book/magazine/")
def magazine():
    book_list = [
        {"book_name": "《一拳超人》", "author": "村田雄介", "money": "￥36"},
        {"book_name": "《妖精的尾巴》", "author": "真岛浩", "money": "￥28"},
        {"book_name": "《进击的巨人》", "author": "谏山创", "money": "￥30"},
        {"book_name": "《黑白无双》", "author": "于彦舒", "money": "￥28"},
        {"book_name": "《巫农列传》", "author": "丁大风风", "money": "￥32"}
    ]
    return render_template("book.html", **locals())


@app.route("/book/cartoon/")
def cartoon():
    book_list = [
        {"book_name": "《读者》", "author": "李月亮", "money": "￥21"},
        {"book_name": "《瑞丽》", "author": "瑞丽杂志社", "money": "￥28"},
        {"book_name": "《故事会》", "author": "故事会编辑部", "money": "￥25"},
        {"book_name": "《知音》", "author": "知音集团", "money": "￥28"},
        {"book_name": "《青年文摘》", "author": "青年文摘杂志社", "money": "￥18"}
    ]
    return render_template("book.html", **locals())


@app.route("/book/r_b/")
def r_b():
    book_list = [
        {"book_name": "《英才教程》", "author": "詹昌斌", "money": "￥36"},
        {"book_name": "《5年高考3年模拟》", "author": "曲一线", "money": "￥28"},
        {"book_name": "《典中点》", "author": "荣德基", "money": "￥30"},
        {"book_name": "《北大绿卡》", "author": "龚云霞", "money": "￥28"},
        {"book_name": "《状元笔记》", "author": "洪林旺", "money": "￥32"}
    ]
    return render_template("book.html", **locals())


if __name__ == '__main__':
    app.run()







